cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 11)

# 工程名称
project(SimEngine DESCRIPTION "仿真中间件")

#安装路径前缀，用于发布产品时
if (WIN32)
    set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/dist/Windows_x64-" CACHE PATH "default intall path" FORCE)
elseif (UNIX)
    set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/dist/linux" CACHE PATH "default intall path" FORCE)
endif ()

# Change the default build type to Release
IF (NOT CMAKE_BUILD_TYPE)
    SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
ENDIF (NOT CMAKE_BUILD_TYPE)
# 支持项目文件目录
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

if (MSVC)
    # 设置vs启动项
    #	if (NOT ${CMAKE_VERSION} VERSION_LESS "3.6.0")
    #		set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
    #	endif ()

    #1. 设置源码字符集和执行字符集都改为UTF-8 ,否则会出现warning C4819。但如果使用VS2019调试可能中文在终端中显示乱码
    #	add_compile_options(/utf-8)

    #2. 仅仅设置源码字符集为UTF-8，执行字符集为默认 add_compile_options(/execution-charset:gbk)，此时用VS2019调试应该不会由乱码
    add_compile_options(/source-charset:utf-8)
    #	add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")

    #生成调试信息用于release版本调试
#    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
#    set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF" )
#    set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF" )

endif (MSVC)





#对外交付的程序
ADD_SUBDIRECTORY(applications)
#测试程序
#ADD_SUBDIRECTORY(tests)
#模型库
ADD_SUBDIRECTORY(src)
